package com.study.mapper;


import com.study.entity.Emp;
import com.study.entity.EmpQueryParam;
import com.study.entity.InfoCount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {

  /*  @Select("SELECT COUNT(*) FROM emp")
     Long count();

    @Select("SELECT t1.*,t2.name deptName FROM emp t1   LEFT JOIN dept t2    ON t1.dept_id = t2.id LIMIT #{startPage} , #{pageSize}")
    List<Emp> list(@Param("startPage") Integer startPage,@Param("pageSize") Integer pageSize);*/
    //当有多个参数要传 需要加@Param注解

    //使用分页依赖优化写法
  /*  @Select("SELECT t1.*,t2.name deptName FROM emp t1 LEFT JOIN dept t2 ON t1.dept_id = t2.id")
    List<Emp> list();*/

    List<Emp> list(EmpQueryParam param);

    void insertEmp(Emp emp);

    void delete(@Param("ids") Integer[] ids);

    Emp selectById(Integer id);

    void update(Emp emp);

    List<Emp> selectAll();

    Integer countMale();

    Integer countFemale();

    List<InfoCount> countJob();
}
